import {ref, reactive} from "vue";
import {defineStore} from "pinia";
import CacheUtils from "@/utils/CacheUtils";

export const userStore = defineStore("user", () => {
    const userInfo = reactive({}); //用户信息


    const userInfoInit = async (data) => {
        await getUserInfo(data);

    };

    const getUserInfo = async (res) => {

    };

    const getCacheUserInfo = async () => {
        const data = CacheUtils.getCache("userInfo") || {};
        Object.assign(userInfo, data);
    };


    return {
        userInfo,
        getUserInfo,
        getCacheUserInfo,
        userInfoInit,
    };
});
